java.lang.ObjectClockDisplay12
public class ClockDisplay12
The ClockDisplay class implements a digital clock display for a European-style 24 hour clock. The clock shows hours and minutes. The range of the clock is 00:00 (midnight) to 23:59 (one minute before midnight). The clock display receives "ticks" (via the timeTick method) every minute and reacts by incrementing the display. This is done in the usual clock fashion: the hour increments when the minutes roll over to zero.
| Field Summary | |
|---|---|
static java.lang.String |
AM
|
static java.lang.String |
PM
|
| Constructor Summary | |
|---|---|
ClockDisplay12()
Constructor for ClockDisplay objects. |
|
ClockDisplay12(int hour,
int minute,
java.lang.String choice)
Constructor for ClockDisplay objects. |
|
| Method Summary | |
|---|---|
java.lang.String |
getTime()
Return the current time of this display in the format HH:MM. |
void |
setTime(int hour,
int minute,
java.lang.String choice)
Set the time of the display to the specified hour and minute. |
void |
timeTick()
This method should get called once every minute - it makes the clock display go one minute forward. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String AM
public static final java.lang.String PM
| Constructor Detail |
|---|
public ClockDisplay12()
public ClockDisplay12(int hour,
int minute,
java.lang.String choice)
hour: - the hour that the user would like the clockminute: - the minute that will be displayed if 60 rollsover to 0.choice: - lets the user choose if the time is am/pm.| Method Detail |
|---|
public java.lang.String getTime()
public void setTime(int hour,
int minute,
java.lang.String choice)
hour: - the hour that the user would like the clockminute: - the minute that will be displayed if 60 rollsover to 0.choice: - lets the user choose if the time is am/pm.public void timeTick()